package mysqlinit

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Account     string `gorm:"type:varchar(18);not null commit:账号"`
	Real        string `gorm:"type:varchar(16);not null commit:姓名"`
	IdCord      string `gorm:"type:varchar(20);not null commit:身份证号"`
	StraightUrl string `gorm:"type:varchar(255);not null commit:正身份证图片"`
	ReverseUrl  string `gorm:"type:varchar(255);not null commit:反身份证图片"`
	Status      int    `gorm:"type:tinyint(1);default:1;not null commit:1 未审核 2已审核 3 审核不通过"`
}

func (u *User) CreateUser() error {
	return DB.Debug().Create(&u).Error
}
func (u *User) FindUser(account string) error {
	return DB.Debug().Where("account = ?", account).Find(&u).Error
}
func (u *User) UpdateUser(userId int64, status int64) error {
	return DB.Debug().Model(&u).Where("id = ?", userId).Update("status", status).Error
}
